package client.comm.baoding.ui.vm

import android.app.Application
import androidx.lifecycle.MutableLiveData
import client.comm.commlib.network.data.JsonResult
import client.comm.baoding.api.bean.TxJl
import client.comm.baoding.ui.viewmodel.MiddleVm

class TiShuijlViewModel(app: Application) : MiddleVm(app) {
    val isShowing = MutableLiveData<Boolean>(false)
    val type = MutableLiveData<String>("1")

    val isOneLoading = MutableLiveData<Boolean>(false)
    val pageOne = MutableLiveData<Int>(0)
    val callOne = MutableLiveData<JsonResult<TxJl>>()

    fun holdOne() {
        if (isOneLoading.value!!)
            return
        hold({
            server.withdraw_record(pageOne.value!!, type.value!!)
        }, {
            isOneLoading.value = true
            pageOne.value = pageOne.value!! + 1
        }, {
            callOne.value = it
        }, complete = {
            isOneLoading.value = false
        })
    }
}